package com.chen.androidstudy.activity.recycle;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;

import com.chen.androidstudy.R;

/**
 * @Author: CHong
 * @CreateDate: 2024/9/3 0003
 * @Description:
 */

public class RecycleViewItemAdapter extends RecyclerView.Adapter<RecycleViewItemAdapter.MyHolder> {

    @NonNull
    @Override
    public MyHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_layout,null,false);
        return new MyHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull MyHolder holder, int position) {
        holder.itemView.setAlpha(1);
    }

    @Override
    public int getItemCount() {
        return 40;
    }

    public static class MyHolder extends RecyclerView.ViewHolder{
        public ConstraintLayout itemLayout;
        public MyHolder(@NonNull View itemView) {
            super(itemView);
            itemLayout = itemView.findViewById(R.id.clLayout);
        }
    }
}
